package com.pubinfo.passbook.data.quartz.task;

import com.pubinfo.passbook.common.mapper.TSourcePassbookMapper;
import com.pubinfo.passbook.common.service.master.TPassbookService;
import com.pubinfo.passbook.data.service.DownLoadPDFService;
import com.pubinfo.passbook.data.service.TFileInfoService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@DisallowConcurrentExecution //作业不并发
@Component
public class SynDownloadFileJob implements Job {
  @Autowired
  DownLoadPDFService downLoadPDFByEInvoiceId;
  @Autowired
  TFileInfoService tFileInfoService;
  
  @SneakyThrows
  @Override
  public void execute(JobExecutionContext jobExecutionContext) {
    //下载票据pdf并上传至ftp
    downLoadPDFByEInvoiceId.downLoadPDF();
    tFileInfoService.uploadPdf2Ftp();
  }
}
